home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
asmutil
/
bluebook.zip
/
GRAPHICS.DOC
< prev
next >
Wrap
Text File
|
1986-05-08
|
14KB
|
352 lines
GRAPHICS.DOC -- Graphic Plotting Procedures
===========================================
From `BLUEBOOK of ASSEMBLY ROUTINES for the IBM PC & XT'
by Christopher L. Morgan
Copyright (C) 1984 by The Waite Group, Inc.
Purpose: GRAPHICS.ASM contains routines to perform fundamental plotting jobs
on the IBM PC. These include point plotting, line drawing, character
drawing, and filling of areas. GRAPHICS.DOC describes the routines.
Contents:
---------
CLS -- Clear the screen
GET_COLOR -- Get the color of a point on the med res color screen
GMSG_OUT -- Plot a string
PAINT -- Fill an area with specified color
RCHAR -- Plot a raster character
SCHAR -- Plot a stroke character
SET_BOX -- Fill a rectangular box with specified color
SET_LIN -- Draw a line
SET_PT -- Plot a point
XOR_BOX -- Fill a rectangular box using XOR
XOR_PT -- Plot a point using XOR
_____________________________________________________________________________
Primitive Functions
-------------------
CLS -- Clear the graphics screen.
Function: This routine clears the color graphics screen.
Input: None.
Output: Just to the screen.
Registers used: Unmodified; AX & CX are saved, then restored.
Segments referenced: Upon entry, ES must point to screen RAM at B8000H.
Routines called: None.
-----------------------------------------------------------------------------
SET_PT -- Plot a point on the medium resolution color screen.
Function: This routine plots a point on the medium resolution color graphics
screen. The pixel at the specified location is given a specified color,
over-writing the old color.
Input: Upon entry:
X-coordinate (0-319) of the point is in SI
Y-coordinate (0-199) of the point is in DI
color (0-3) is in DX.
Output: Just to the screen.
Registers used: Unmodified; SI,DI, & DX are used for input.
Segments referenced: Upon entry, ES must point to video RAM at B8000, and
DS must point to a data segment containing the following look-up table
of rotated color masks:
CTABLE DW 0003FH,0403FH,0803FH,0C03FH
DW 000CFH,010CFH,020CFH,030CFH
DW 000F3H,004F3H,008F3H,00CF3H
DW 000FCH,001FCH,002FCH,003FCH
Routines called: None.
Note: No bounds checking is performed. Programmer must ensure the
coordinates and color are in their proper ranges.
-----------------------------------------------------------------------------
XOR_PT -- Plot a point using XOR onto the med res color screen.
Function: This routine plots a point on the med res screen using the
`exclusive or' operation. The pixel at the specified location is colored
with a color obtained by `exclusive oring' its original color with a
specified color. This function is useful for making cursors.
Input: Upon entry:
X-coordinate (0-319) of the point is in SI
Y-coordinate (0-199) of the point is in DI
color (0-3) is in DX.
Output: Just to the screen.
Registers used: Unmodified; SI,DI, & DX are used for input.
Segments referenced: Upon entry, ES must point to video RAM at B8000, and
DS must point to a data segment containing the following look-up table
of rotated color masks:
CTABLE DW 0003FH,0403FH,0803FH,0C03FH
DW 000CFH,010CFH,020CFH,030CFH
DW 000F3H,004F3H,008F3H,00CF3H
DW 000FCH,001FCH,002FCH,003FCH
Routines called: None.
Note: No bounds checking is performed. Programmer must ensure the
coordinates and color are in their proper ranges.
-----------------------------------------------------------------------------
GET_COLOR -- Get color of a point on med res screen.
Function: This routine returns the color of a specified point on the med
res color screen. The color is returned in AL.
Input: Upon entry:
X-coordinate (0-319) of the specified point is in SI
Y-coordinate (0-199) of the specified point is in DI.
Output: Upon exit, AL contains the color (0-3) of the pixel at the
specified location.
Registers used: Only AX is modified. SI & DI are used for input and AL is
used for output.
Segments referenced: Upon entry, ES must point to the video RAM at B8000H.
Routines called: None.
Note: No bounds checking is performed. Programmer must ensure the
coordinates and color are in their proper ranges.
-----------------------------------------------------------------------------
SET_BOX -- Fill a rectangular box.
Function: This routine fills a rectangular box on the color graphics screen
with a specified color.
Input: Upon entry:
X-coordinate of upper left corner is in X1
Y-coordinate of upper left corner is in Y1
X-coordinate of lower right corner is in X2
Y-coordinate of lower right corner is in Y2
Color of the rectangle is in bits 0 & 1 of COLOR.
Output: Just to the screen.
Registers used: Unmodified; SI, DI, DX, BX, CX, & AX are save & restored.
Segments referenced: Upon entry, ES must point to video RAM at B8000, and
DS must point to a data segment containing the following look-up table
for color masks:
XTABLE DW 0FFC0H,0FFF0H,0FFFCH,0FFFFH
DW 03FC0H,03FF0H,03FFCH,03FFFH
DW 00FC0H,00FF0H,00FFCH,00FFFH
DW 003C0H,003F0H,003FCH,003FFH
Routines called: None.
Note: No bounds checking is performed. Programmer must ensure the
coordinates are in their proper range and order; i.e., the following
must be true:
0 <= X1 <= X2 <= 319
0 <= Y1 <= Y2 <= 199.
-----------------------------------------------------------------------------
XOR_BOX -- Fill a rectangular box using XOR.
Function: This routine fills a rectangular box in the color graphics screen
with a given color using the `exclusive or' operation. Each pixel in the
rectangle is colored with a color obtained by `exclusive oring' its
original color with a specified color. This function is useful for
making cursors.
Input: Upon entry:
X-coordinate of upper left corner is in X1
Y-coordinate of upper left corner is in Y1
X-coordinate of lower right corner is in X2
Y-coordinate of lower right corner is in Y2
Color of the rectangle is in bits 0 & 1 of COLOR.
Output: Just to the screen.
Registers used: Unmodified; SI, DI, DX, BX, CX, & AX are saved & restored.
Segments referenced: Upon entry, ES must point to video RAM at B8000, and
DS must point to a data segment containing the following look-up table
for color masks:
XTABLE DW 0FFC0H,0FFF0H,0FFFCH,0FFFFH
DW 03FC0H,03FF0H,03FFCH,03FFFH
DW 00FC0H,00FF0H,00FFCH,00FFFH
DW 003C0H,003F0H,003FCH,003FFH
Routines called: None.
Note: No bounds checking is performed. Programmer must ensure the
coordinates are in their proper range and order; i.e., the following
must be true:
0 <= X1 <= X2 <= 319
0 <= Y1 <= Y2 <= 199.
-----------------------------------------------------------------------------
Second Level Functions (use Primitive Functions)
----------------------
SET_LIN -- Draw a line.
Function: This routine draws a line from (X1,Y1) to (X2,Y2) in the specified
color. It uses Bresenham's algorithm.
Input: Upon entry:
X-coordinate of starting point is in X1
Y-coordinate of starting point is in Y1
X-coordinate of ending point is in X2
Y-coordinate of ending point is in Y2
Color of line is in COLOR.
Output: Just to the screen.
Registers used: Unmodified; BX, CX, DX, SI, DI, & AX are saved & restored.
Segments referenced: Upon entry, ES must point to video RAM at B8000H, and
DS must point to a data segment used by the SET_PT plotting routine.
Routines called: SET_PT.
Note: No bounds checking is performed. Programmer must ensure the
coordinates are in their proper range; i.e., the following
must be true:
0 <= X1 & X2 <= 319
0 <= Y1 & Y2 <= 199